﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace UniRlv.UI.Main.Widget
{
    public partial class FrmRadioButtonSelect : DialogBase
    {
        public string Tip { get; set; }
        public string[] Values { get; set; }
        public int CurSelect { get; set; }

        public FrmRadioButtonSelect()
        {
            InitializeComponent();
        }

        private void FrmRadioButtonSelect_Load(object sender, EventArgs e)
        {
            if (Values.Length>2)
            {
                radioButton3.Visible = true;
                radioButton3.Text = Values[2];
            }

            groupBox1.Text = Tip;
            radioButton1.Text = Values[0];
            radioButton2.Text = Values[1];

            switch (CurSelect)
            {
                case 0:
                    radioButton1.Checked = true;
                    break;
                case 1:
                    radioButton2.Checked = true;
                    break;
                case 2:
                    radioButton3.Checked = true;
                    break;
                default:
                    radioButton1.Checked = true;
                    break;
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            CurSelect = radioButton1.Checked ? 0 : CurSelect;
            CurSelect = radioButton2.Checked ? 1 : CurSelect;
            CurSelect = radioButton3.Checked ? 2 : CurSelect;

            Close();
        }
    }
}
